/* 通用消息组件样式 */
.message-font {
  font-size: 14px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
}

.message-title {
  display: flex;
  align-items: center;
  padding: 4px 8px;
  gap: 4px;
  border-bottom: 1px solid rgba(75, 85, 99, 0.2);
}

.message-title-icon {
  width: 1rem;
  height: 1rem;
  margin-right: 0.5rem;
}

.message-title-text {
  font-weight: 600;
  font-size: 0.6rem;
}

.message-toggle-button {
  margin-right: 0.5rem;
  padding: 0.125rem;
  border-radius: 0.25rem;
  transition-property: background-color;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 150ms;
}

.message-toggle-button:hover {
  background-color: rgba(55, 65, 81, 1);
}

.message-toggle-icon {
  width: 0.75rem;
  height: 0.75rem;
}

.message-content-container {
  margin-top: 0.5rem;
  background-color: rgba(31, 41, 55, 0.5);
  border-radius: 0.375rem;
  overflow: hidden;
  border: 1px solid rgba(55, 65, 81, 1);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* 最大化按钮样式 */
.message-maximize-button {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 2px;
  border-radius: 3px;
  transition: all 0.2s;
}

.message-maximize-button:hover {
  background-color: rgba(59, 130, 246, 0.1);
} 

/* Custom scrollbar styles */
.scrollbar-thin::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.scrollbar-thumb-gray-600::-webkit-scrollbar-thumb {
  background-color: rgba(156, 163, 175, 0.5);
  border-radius: 3px;
}

.scrollbar-thumb-gray-600::-webkit-scrollbar-track {
  background-color: rgba(75, 85, 99, 0.1);
}

/* Improve tooltip experience */
.cursor-help {
  transition: all 0.2s ease;
  word-wrap: break-word;
  word-break: break-word;
}

.cursor-help:hover {
  color: #e5e7eb;
}

/* Ensure text wrapping */
.break-words {
  word-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
}

/* Markdown内容容器 */
.markdown-content {
  padding: 4px;
  color: #e5e7eb;
  line-height: 1.4;
  font-size: 14px;
}

.markdown-body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
}

/* GitHub风格的Markdown表格样式 */
.markdown-table-container {
  margin: 4px 0;
  border-radius: 6px;
  overflow: hidden;
}

.markdown-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.5;
  border: 1px solid rgba(75, 85, 99, 0.4);
  border-radius: 6px;
}

.markdown-th {
  padding: 4px 8px;
  text-align: left;
  font-weight: 600;
  background-color: rgba(45, 55, 72, 0.6);
  border: 1px solid rgba(75, 85, 99, 0.4);
  color: #e5e7eb;
}

.markdown-td {
  padding: 4px 8px;
  border: 1px solid rgba(75, 85, 99, 0.3);
  color: #e5e7eb;
  background-color: rgba(31, 41, 55, 0.3);
}

.markdown-table tr:nth-child(even) .markdown-td {
  background-color: rgba(31, 41, 55, 0.5);
}

.overflow-auto {
  overflow: auto;
}

/* GitHub风格的Markdown代码样式 */
.markdown-code-wrapper {
  position: relative;
  margin: 4px 0;
  border-radius: 6px;
  overflow: hidden;
  background-color: rgba(30, 41, 59, 0.8);
}

.markdown-code-wrapper::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #0ea5e9, #7c3aed);
  z-index: 1;
}

/* 代码语言标签 */
.code-language-tag {
  position: absolute;
  top: 0;
  right: 0;
  font-size: 11px;
  font-weight: 600;
  color: #e5e7eb;
  background-color: rgba(45, 55, 72, 0.8);
  padding: 2px 8px;
  border-radius: 0 0 0 4px;
  text-transform: uppercase;
  z-index: 2;
}

.markdown-code-block {
  margin: 0 !important;
  border-radius: 0 0 6px 6px !important;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace !important;
  font-size: 13px !important;
  line-height: 1.6 !important;
  tab-size: 4;
}

.markdown-inline-code {
  padding: 0.1em 0.3em;
  margin: 0 0.1em;
  border-radius: 3px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 126%;
  background-color: rgba(81, 55, 75, 0.4);
  color: #df520c;
  display: inline !important;        /* 行内显示，避免单独换行 */
  white-space: break-spaces !important; /* 保留空格并允许自动换行 */
  word-break: break-word;            /* 长单词自动换行，防止溢出 */
}

/* GitHub风格的Markdown其他元素样式 */
.markdown-paragraph {
  margin: 4px 0;
  line-height: 1.4;
}

.markdown-link {
  color: #3b82f6;
  text-decoration: none;
  transition: color 0.2s;
}

.markdown-link:hover {
  text-decoration: underline;
  color: #60a5fa;
}

.markdown-blockquote {
  margin: 4px 0;
  padding: 0 8px;
  color: #9ca3af;
  border-left: 4px solid #3b82f6;
  background-color: rgba(31, 41, 55, 0.3);
  border-radius: 0 3px 3px 0;
}

.markdown-blockquote > * {
  margin: 4px 0;
}

.markdown-list {
  margin: 4px 0;
  padding-left: 16px;
}

.markdown-list-item {
  margin: 2px 0;
}

.markdown-ul {
  list-style-type: disc;
}

.markdown-ol {
  list-style-type: decimal;
}

.markdown-heading {
  margin-top: 16px;
  margin-bottom: 8px;
  font-weight: 600;
  line-height: 1.2;
  color: #e5e7eb;
}

.markdown-h1 {
  padding-bottom: 4px;
  font-size: 2em;
  border-bottom: 1px solid rgba(75, 85, 99, 0.3);
  margin-top: 0;
}

.markdown-h2 {
  padding-bottom: 4px;
  font-size: 1.5em;
  border-bottom: 1px solid rgba(75, 85, 99, 0.3);
}

.markdown-h3 {
  font-size: 1.25em;
}

.markdown-h4 {
  font-size: 1em;
}

.markdown-h5 {
  font-size: 0.875em;
}

.markdown-h6 {
  font-size: 0.85em;
  color: #9ca3af;
}

.markdown-hr {
  height: 0.25em;
  padding: 0;
  margin: 12px 0;
  background-color: rgba(75, 85, 99, 0.3);
  border: 0;
  border-radius: 3px;
}

.markdown-img {
  max-width: 100%;
  border-radius: 6px;
  margin: 8px 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 改进的代码高亮样式 */
pre[class*="language-"] {
  position: relative;
  overflow: auto;
  margin: 0;
  padding: 10px !important;
}

/* 添加语言标签 */
pre[class*="language-"]::before {
  content: attr(data-language);
  position: absolute;
  top: 0;
  right: 0;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  color: #e5e7eb;
  background-color: rgba(45, 55, 72, 0.8);
  border-radius: 0 0 0 4px;
  text-transform: uppercase;
  z-index: 1;
}

/* 暗色主题优化 */
.dark {
  color-scheme: dark;
}

/* 列表嵌套样式 */
.markdown-ul .markdown-ul,
.markdown-ol .markdown-ol {
  margin: 2px 0;
}

/* 链接内容溢出保护 */
.markdown-link {
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
}

/* 表格样式 - 确保响应式 */
@media (max-width: 640px) {
  .markdown-table-container {
    overflow-x: auto;
  }
  
  .markdown-th,
  .markdown-td {
    padding: 3px 6px;
    font-size: 13px;
  }
}

/* 高亮文本样式 */
mark {
  background-color: rgba(250, 204, 21, 0.2);
  color: #fbbf24;
  padding: 0 0.2em;
  border-radius: 2px;
}

/* 复制按钮样式 */
.message-copy-button {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 2px;
  border-radius: 3px;
  transition: all 0.2s;
}

.message-copy-button:hover {
  background-color: rgba(59, 130, 246, 0.1);
}

/* 用户消息内容支持横向滚动 */
.user-message-content {
  overflow-x: auto;
  white-space: pre;
  max-width: 100%;
}
